package com.laotou99.wmsjjj.wmsjjj.utils;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
 

public class ToolsUtils {

	//可根据实际情况动态设置ASN号码的长度
	private final static int ASN_NUM_LENGTH = 13;
	
	private final static int LOT_NUM_LENGTH = 13;
	
	public static String addLotZero(long l1) {
		String result = ""+l1;
		String strZero = "";
		int i1 = result.length();

		if(i1<=LOT_NUM_LENGTH) {
			int i2 = LOT_NUM_LENGTH - i1;
			for(int i3 = 0;i3<i2;i3++) {
				strZero=strZero+"0";
			}
			result = "LOT"+strZero+result;
		} 
		
		return result;
	}
	
	public static String addZero(long l1) {
		String result = ""+l1;
		String strZero = "";
		int i1 = result.length();
		
		if(i1<=ASN_NUM_LENGTH) {
			int i2 = ASN_NUM_LENGTH - i1;
			for(int i3 = 0;i3<i2;i3++) {
				strZero=strZero+"0";
			}
			result = "ASN"+strZero+result;
		}
		
		return result;
	}

	public static <T> List<T> copyIterator(Iterator<T> iter) { 
		List<T> copy = new ArrayList<T>();  
	    while (iter.hasNext())  
	        copy.add(iter.next());  
	    return copy;  
	}
	
	public static <T> List<T> copyIteratorToList(Iterable<T> iter){
		
		List<T> copy = new ArrayList<T>();
		for(Iterator<T> iter1=iter.iterator();iter1.hasNext();) {
			T e = iter1.next();
			copy.add(e);
		}
		return copy;
	}

}
